package com.yidu.qianfeng.controller;

import com.yidu.qianfeng.common.bean.waybill.Waybill;
import com.yidu.qianfeng.service.impl.TargetBizImpl;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller("targetController")
public class TargetController {
    @Resource(name = "targetBizImpl")
    private TargetBizImpl biz;
    @RequestMapping("/goAddfinance")
    public String goAddfinance(){
        return "views/bill";
    }
    @RequestMapping("/goAddwaybilltarget")
    public String goAddwaybilltarget(){
        return "views/waybilltarget";
    }
    
    @RequestMapping("/financecount")
    public @ResponseBody int financecount(String waybill_consign_date, String waybill_promise_date){

        return biz.financecount(waybill_consign_date,waybill_promise_date);
    }

    @RequestMapping("/Waybillincome")
    public @ResponseBody int Waybillincome(String waybill_consign_date, String waybill_promise_date){

        return biz.Waybillincome(waybill_consign_date,waybill_promise_date);
    }

    @RequestMapping("/rebatecollection")
    public @ResponseBody int rebatecollection(String waybill_consign_date, String waybill_promise_date){

        return biz.rebatecollection(waybill_consign_date,waybill_promise_date);
    }

    @RequestMapping("/pickupfee")
    public @ResponseBody int pickupfee(String waybill_consign_date, String waybill_promise_date){

        return biz.pickupfee(waybill_consign_date,waybill_promise_date);
    }

    @RequestMapping("/transportcount")
    public @ResponseBody int transportcount(String trans_depart_date, String trans_promise_date){

        return biz.transportcount(trans_depart_date,trans_promise_date);
    }

    @RequestMapping("/transporttotal")
    public @ResponseBody int transporttotal(String trans_depart_date, String trans_promise_date){

        return biz.transporttotal(trans_depart_date,trans_promise_date);
    }

    @RequestMapping("/sendtcount")
    public @ResponseBody int sendtcount(String trans_depart_date, String trans_promise_date){

        return biz.sendtcount(trans_depart_date,trans_promise_date);
    }
    @RequestMapping("/sendttotal")
    public @ResponseBody int sendttotal(String trans_depart_date, String trans_promise_date){

        return biz.sendttotal(trans_depart_date,trans_promise_date);
    }
    @RequestMapping("/grosstotal")
    public @ResponseBody int grosstotal(String trans_depart_date, String trans_promise_date){

        int count=biz.Waybillincome(trans_depart_date,trans_promise_date);
        int count1=biz.rebatecollection(trans_depart_date,trans_promise_date);
        int count2=biz.pickupfee(trans_depart_date,trans_promise_date);
        int count3=biz.transporttotal(trans_depart_date,trans_promise_date);
        int count4=biz.sendttotal(trans_depart_date,trans_promise_date);
        int count5=count-count1-count2-count3-count4;
        return count5;
    }
    @RequestMapping("/selectindicator")
    @ResponseBody
    public Map selectindicator( ){

        List<Waybill> data=biz.selectindicator();
        Map map=new HashMap();
        map.put("code",0);
        map.put("msg","");
        map.put("count",0);
        map.put("data",data);
        return map;
    }
}
